<template>
  <div class="couponBox warp" :class="['arrange'+(componentContent.arrangeActiveIndex+1),'color'+(componentContent.colorActiveIndex+1)]">
    <div class="couponListBox">
      <div class="listItemBox" :class="['cardStyle'+(componentContent.cardActiveIndex+1)]">
        <div class="listItemBoxInner">
          <div class="itemInfo">
            <div class="amount">
              <span>100<i>元</i></span>
            </div>
            <div class="couponInfo">
              <span>优惠券名称</span>
              <p>无门槛使用全部商品</p>
            </div>
          </div>
          <div class="receiveBtn">
            <span>领取</span>
          </div>
        </div>
      </div>
      <div class="listItemBox" :class="['cardStyle'+(componentContent.cardActiveIndex+1)]">
        <div class="listItemBoxInner">
          <div class="itemInfo">
            <div class="amount">
              <span>9<i>折</i></span>
            </div>
            <div class="couponInfo">
              <span>优惠券名称</span>
              <p>无门槛使用全部商品</p>
            </div>
          </div>
          <div class="receiveBtn">
            <span>领取</span>
          </div>
        </div>
      </div>
      <div class="listItemBox" :class="['cardStyle'+(componentContent.cardActiveIndex+1)]">
        <div class="listItemBoxInner">
          <div class="itemInfo">
            <div class="amount">
              <span>9<i>折</i></span>
            </div>
            <div class="couponInfo">
              <span>优惠券名称</span>
              <p>无门槛使用全部商品</p>
            </div>
          </div>
          <div class="receiveBtn">
            <span>领取</span>
          </div>
        </div>
      </div>
      <div class="listItemBox" :class="['cardStyle'+(componentContent.cardActiveIndex+1)]">
        <div class="listItemBoxInner">
          <div class="itemInfo">
            <div class="amount">
              <span>9<i>折</i></span>
            </div>
            <div class="couponInfo">
              <span>优惠券名称</span>
              <p>无门槛使用全部商品</p>
            </div>
          </div>
          <div class="receiveBtn">
            <span>领取</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'textComponent',
  props: {
    terminal: {
      type: Number,
      default: 4
    },
    componentContent: {
      type: Object
    }
  }
}
</script>

<style lang="scss" scoped>
.couponBox {
  margin: 0 auto;
  padding: 20px 0 10px;
  .couponListBox {
    /**默认**/
    .listItemBox {
      margin-bottom: 10px;
      width: 100%;
      height: 100px;
      position: relative;
      overflow: hidden;
      .listItemBoxInner{
        background-color: #c8c9cc;
        display: flex;
        width: 100%;
        padding: 10px;
        height: 100px;
      }
      .itemInfo {
        display: flex;
        align-items: center;
        color: #FFFFFF;
        padding-right: 25px;
        flex: 1;
        .amount {
          display: flex;
          align-items: flex-end;
          margin-right: 5px;
          min-width: 70px;
          justify-content: center;
          span {
            font-size: 26px;
            font-weight: bold;
          }
          i {
            font-size: 12px;
            font-style: normal;
            padding-left: 2px;
          }
        }
        .couponInfo {
          span {
            font-size: 14px;
          }
          p {
            font-size: 12px;
            margin-top: 5px;
            opacity: .8;
          }
        }
      }
      .receiveBtn {
        display: flex;
        width: 100px;
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
        position: relative;
      }
    }
    /**样式1**/
    .cardStyle1 {
      position: relative;
      padding: 0 11px;
      &:before,&:after{
        height: 100%;
        width: 11px;
        content: "";
        background-size:100% 100%;
        position: absolute;
        top: 0;
      }
      &:before{
        left: 0;
      }
      &:after{
        right: 0;
        transform: rotateY(180deg);
      }
      .receiveBtn {
        border-left: 1px #eeeeee dashed;
        &:before,&:after{
          position: absolute;
          display: flex;
          width: 14px;
          height: 14px;
          background-color: #fff;
          border-radius: 50%;
          content: "";
          left: -7px;
        }
        &:before {
          top: -17px;
        }
        &:after {
          bottom: -17px;
        }
      }
    }
    /**样式2**/
    .cardStyle2 {
      position: relative;
      padding: 0 18px;
      &:before,&:after{
        height: 100%;
        width: 18px;
        content: "";
        background-size:100% 100%;
        position: absolute;
        top: 0;
      }
      &:before{
        left: 0;
      }
      &:after{
        right: 0;
        transform: rotateY(180deg);
      }
      .listItemBoxInner{
        position: relative;
        &:before,&:after{
          height: 0.5px;
          width: 100%;
          content: "";
          position: absolute;
          left: 0;
          background-color: #fff;
        }
        &:before{
          top: 5px;
        }
        &:after{
          bottom: 5px;
        }
      }
      .receiveBtn {
      }
    }
    /**样式3**/
    .cardStyle3 {
      .itemInfo{
        background-color: #fff;
      }
      .receiveBtn {
        &:before{
          position: absolute;
          display: flex;
          width: 14px;
          height: 14px;
          background-color: #fff;
          border-radius: 50%;
          content: "";
          right: -17px;
          top: 50%;
          margin-top: -7px;
        }
      }
    }
    /**样式4**/
    .cardStyle4 {
      .listItemBoxInner{
        background-color: #f2f3f3 !important;
      }
    }
  }

  @mixin cardColor($bgColor: #FF3737,$fontColor: #fff) {
    .couponListBox {
      .listItemBox {
        .listItemBoxInner{
          background: $bgColor;
        }
        .itemInfo {
          .amount {
            span {
              color: $fontColor;
              i {
                color: $fontColor;
              }
            }
          }
          .couponInfo {
            color:$fontColor;
          }
        }
        .receiveBtn {
          span {
            color: $fontColor;
          }
        }
        &.cardStyle3{
          .itemInfo {
            .amount {
              span {
                color: $bgColor;
                i {
                  color: $bgColor;
                }
              }
            }
            .couponInfo {
              color:$bgColor;
            }
          }
        }
        &.cardStyle4{
          border: 2px solid $bgColor;
          padding: 5px;
          .listItemBoxInner{
            padding: 20px 15px;
            height: 85px;
            border: 1px solid $bgColor;
          }
          .itemInfo {
            .amount {
              span {
                color: $bgColor;
                i {
                  color: $bgColor;
                }
              }
            }
            .couponInfo {
              color:$bgColor;
            }
          }
          .receiveBtn {
            border-left: 1px $bgColor dashed;
            span {
              color: $bgColor;
            }
          }
        }
      }
    }
  }

  &.arrange1{

  }
  &.arrange2{
    max-width: 96%;
    .couponListBox{
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      .listItemBox{
        width: 48%;
      }
    }
  }
  &.arrange3{
    max-width: 96%;
    .couponListBox{
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      .listItemBox{
        width: 32%;
      }
    }
  }
  &.arrange4{
    max-width: 96%;
    .couponListBox{
      display: flex;
      overflow: auto;
      .listItemBox{
        width: 400px;
        flex: 0 0 400px;
        margin-left: 30px;
        &:first-child{
          margin-left: 0;
        }
      }
    }
  }

  &.color1{
    @include cardColor(#FF3737);
    .couponListBox {
      .cardStyle1 {
        &:before, &:after {
          background-image: url('../../../assets/images/coupon/card-side-red.png');
        }
      }
      .cardStyle2 {
        &:before, &:after {
          background-image: url('../../../assets/images/coupon/card-side-red2.png');
        }
      }
    }
  }

  &.color2{
    @include cardColor(#86A7FF);
    .couponListBox {
      .cardStyle1 {
        &:before, &:after {
          background-image: url('../../../assets/images/coupon/card-side-blue.png');
        }
      }
      .cardStyle2 {
        &:before, &:after {
          background-image: url('../../../assets/images/coupon/card-side-blue2.png');
        }
      }
    }
  }

  &.color3{
    @include cardColor(#98D4CB);
    .couponListBox {
      .cardStyle1 {
        &:before, &:after {
          background-image: url('../../../assets/images/coupon/card-side-green.png');
        }
      }
      .cardStyle2 {
        &:before, &:after {
          background-image: url('../../../assets/images/coupon/card-side-green2.png');
        }
      }
    }
  }

  &.color4{
    @include cardColor(#FF8888);
    .couponListBox {
      .cardStyle1 {
        &:before, &:after {
          background-image: url('../../../assets/images/coupon/card-side-pink.png');
        }
      }
      .cardStyle2 {
        &:before, &:after {
          background-image: url('../../../assets/images/coupon/card-side-pink2.png');
        }
      }
    }
  }

  &.color5{
    @include cardColor(#AFAFAF);
    .couponListBox {
      .cardStyle1 {
        &:before, &:after {
          background-image: url('../../../assets/images/coupon/card-side-grey.png');
        }
      }
      .cardStyle2 {
        &:before, &:after {
          background-image: url('../../../assets/images/coupon/card-side-grey2.png');
        }
      }
    }
  }
}
</style>
